package ch.upndown.upndown;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        testest();
    }

    public void testest(){
        Pattern p = Pattern.compile("<[^<]+shortcut icon[^>]+>");
        Matcher m = p.matcher("<link rel='shortcut icon' href='//cdn.sstatic.net/stackoverflow/img/favicon.ico?v=038622610830'><link rel='shortcut icon' href='//cdn.sstatic.net/stackoverflow/img/favicon.ico?v=038622610830'>");
        if (m.find()) {
            Log.d("tt", m.group(0));
            while (m.find()) {
                Log.d("tt", m.group(0));
            }
        }else{
            Log.d("tt", "nö");
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
